<?php Config::set_slot('title', 'Liste des communes') ?>
<?php add_css(Config::get_slot('root', '') . 'css/communes.css')?>
<h1>Les communes</h1>
<?php $communes = $pager->getResults()?>
<?php require('view/commune/_simple-list.php')?>
<?php if($pager->haveToPaginate()): ?>
<div class="pagination">
    <a href="<?php echo link_to('communes/index.html') ?>?page=1"><< </a>
    <a href="<?php echo link_to('communes/index.html')?>?page=<?php echo $pager->getPreviousPage() ?>">< </a>
    <?php foreach($pager->getLinks() as $page): ?>
        <?php if($page == $pager->getPage() ): ?>
            <span class="current-page"><?php echo $pager->getPage() ?></span>
        <?php else: ?>
            <a href="<?php echo link_to('communes/index.html')?>?page=<?php echo $page ?>"><?php echo $page?> </a>
        <?php endif; ?>
    <?php endforeach; ?>
    <a href="<?php echo link_to('communes/index.html') ?>?page=<?php echo $pager->getNextPage() ?>">> </a>
    <a href="<?php link_to('communes/index.html') ?>?page=<?php echo $pager->getLastPage() ?>">>> </a>
</div>
<?php endif; ?>
<div class="commandes">
    <a href="<?php echo link_to('communes/new.html') ?>">Créer</a>
</div>